﻿<Window x:Class="MockSmtpServer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Title="Mock SMTP Server" Height="480" Width="640" Icon="/MockSmtpServer;component/Resources/mail.ico">
    <Window.Background>
        <ImageBrush  ImageSource="/Resources/MockBackground.png" Stretch="UniformToFill"/>
    </Window.Background>
    <DockPanel>
        <DockPanel DockPanel.Dock="Top">
            <DockPanel.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0.716"/>
                    <GradientStop Offset="1" Color="#00000000"/>
                </LinearGradientBrush>
            </DockPanel.Background>
            <Image Source="/Resources/Help.png" Width="24" Height="24"
                   DockPanel.Dock="Right" VerticalAlignment="Center" MouseDown="Image_MouseDown"/>
            <TextBlock Text="Received email messages:" Padding="8" Foreground="White"/>
        </DockPanel>
        <ListBox x:Name="mailListBox" ScrollViewer.CanContentScroll="False" ItemsSource="{Binding Messages}" Margin="8,0,8,8" HorizontalAlignment="Stretch" 
                 Background="Transparent" BorderBrush="LightGray" BorderThickness="1">
            <ListBox.Style>
                <Style>
                    <Style.Resources>
                        <!-- Background of selected item when focussed -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
                        <!-- Background of selected item when not focussed -->
                        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
                    </Style.Resources>
                </Style>
            </ListBox.Style>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <DockPanel TextBlock.FontFamily="Verdana" TextBlock.FontSize="12" TextBlock.Foreground="White" Margin="2" Background="#7F000000">
                        <Border DockPanel.Dock="Top" Margin="0" Padding="8" BorderThickness="1,1,1,0" BorderBrush="Black">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#F0000000" Offset="0"/>
                                    <GradientStop Color="#FF454545" Offset="1"/>
                                </LinearGradientBrush>
                            </Border.Background>
                            <StackPanel Margin="0">
                                <DockPanel>
                                    <TextBlock DockPanel.Dock="Left" FontWeight="Bold" Margin="0,0,4,0"><Run Text="Date:"/></TextBlock>
                                    <TextBlock Text="{Binding Date}" TextWrapping="WrapWithOverflow"/>
                                </DockPanel>
                                <DockPanel>
                                    <TextBlock DockPanel.Dock="Left" FontWeight="Bold" Margin="0,0,4,0"><Run Text="From:"/></TextBlock>
                                    <TextBlock Text="{Binding From}" TextWrapping="WrapWithOverflow" />
                                </DockPanel>
                                <DockPanel>
                                    <TextBlock DockPanel.Dock="Left" FontWeight="Bold" Margin="0,0,4,0"><Run Text="To:"/></TextBlock>
                                    <TextBlock Text="{Binding To}" TextWrapping="WrapWithOverflow" />
                                </DockPanel>
                                <DockPanel>
                                    <TextBlock DockPanel.Dock="Left" FontWeight="Bold" Margin="0,0,4,0"><Run Text="Subject:"/></TextBlock>
                                    <TextBlock Text="{Binding Subject}" TextWrapping="WrapWithOverflow"/>
                                </DockPanel>
                            </StackPanel>
                        </Border>
                        <Border BorderBrush="Black" BorderThickness="1,0,1,1" Background="Transparent">
                            <TextBlock Text="{Binding Message}" TextWrapping="WrapWithOverflow" Margin="4" Padding="4" Foreground="White" Background="Transparent"/>
                        </Border>
                    </DockPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </DockPanel>
</Window>
